package com.endoc.endocbtool.application;

import android.util.Log;
import com.endoc.base.App;
import com.endoc.btmodule.BleModel;

import java.util.UUID;

import cn.com.heaton.blelibrary.ble.Ble;
import cn.com.heaton.blelibrary.ble.Options;

public class MainApplication extends App {

    @Override
    public void onCreate() {
        super.onCreate();

        //蓝牙参数配置
        Options agingTool = Ble.options().setLogTAG("agingTool")
                //.setLogBleExceptions(true)//设置是否输出打印蓝牙日志（非正式打包请设置为true，以便于调试）
                .setThrowBleException(true)//设置是否抛出蓝牙异常
                .setAutoConnect(true)//设置是否自动连接
                .setConnectFailedRetryCount(3)//连接失败重试时间
                .setConnectTimeout(10 * 1000)//设置连接超时时长（默认10*1000 ms）
                .setScanPeriod(10 * 1000)//设置扫描时长（默认10*1000 ms）
                .setMaxConnectNum(5)//默认是7
                .setUuidService(UUID.fromString("0000fff0-0000-1000-8000-00805f9b34fb"))//主服务的uuid
                .setUuidWriteCha(UUID.fromString("0000fff1-0000-1000-8000-00805f9b34fb"));//可写特征的uuid
               /* .setUuidService(UUID.fromString("0000fE40-0000-1000-8000-00805f9b34fb"))//主服务的uuid
                .setUuidWriteCha(UUID.fromString("0000FE41-0000-1000-8000-00805f9b34fb"));//可写特征的uuid*/

        BleModel.initBle(this, agingTool, new Ble.InitCallback() {
            @Override
            public void success() {
                    Log.d("MainApplication","success");
            }

            @Override
            public void failed(int failedCode) {

            }
        });
    }
}
